<template>
    <BaseContainer>
      <aplid-base-crud ref="crud" v-bind="baseConfig">
      <template #isApproval="{ row }">
        <div>
          <el-tag :type="row.isApproval == 1 ? 'success' : 'danger'">{{ row.isApproval == 1 ? '是' : '否' }}</el-tag>
        </div>
      </template>
      <template #isCheck="{ row }">
        <div>
          <el-tag :type="row.isCheck == 1 ? 'success' : 'danger'">{{ row.isCheck == 1 ? '是' : '否' }}</el-tag>
        </div>
      </template>
      <template #isKey="{ row }">
        <div>
          <el-tag :type="row.isKey == 1 ? 'success' : 'danger'">{{ row.isKey == 1 ? '是' : '否' }}</el-tag>
        </div>
      </template>
      <template #isNotNull="{ row }">
        <div>
          <el-tag :type="row.isNotNull == 1 ? 'success' : 'danger'">{{ row.isNotNull == 1 ? '是' : '否' }}</el-tag>
        </div>
      </template>
      <template #isExpireRemind="{ row }">
        <div>
          <el-tag :type="row.isExpireRemind == 1 ? 'success' : 'danger'">{{ row.isExpireRemind == 1 ? '是' : '否'
          }}</el-tag>
        </div>
      </template>
      <template #addDialog>
        <div>
          <CUDialog :tableConfigId="$props.tableConfigId" :tableName="$props.tableName" @updateTable="updateTable">
          </CUDialog>
        </div>
      </template>
      <template #editDialog="{ row }">
        <div>
          <CUDialog :tableConfigId="$props.tableConfigId" :tableName="$props.tableName" :id="row.id"
            @updateTable="updateTable"></CUDialog>
        </div>
      </template>
    </aplid-base-crud>
    </BaseContainer>
</template>

<script setup lang="ts">
import CUDialog from './CUDialog.vue'
import { baseConfig } from './config';
interface Props {
  tableConfigId: number
  tableName: string
}
const props = defineProps<Props>()
const crud = ref(null)
baseConfig.paramsObj = {
  tableConfigId: props.tableConfigId,
  tableName: props.tableName
}
const updateTable = () => {
  crud.value.refreshChange()
}
</script>

<style scoped></style>